﻿namespace FrameworkCore.Modules;

/// <summary>
/// 提供特定键和值类型的单例字典。
/// </summary>
/// <typeparam name="TKey">键的类型。</typeparam>
/// <typeparam name="TValue">值的类型。</typeparam>
public partial class SingletonDictionary<TKey, TValue> : Singleton<IDictionary<TKey, TValue>>
{
    static SingletonDictionary()
    {
        Singleton<Dictionary<TKey, TValue>>.Instance = new Dictionary<TKey, TValue>();
    }

    /// <summary>
    /// 指定类型 T 的单例实例。每种类型 T 只有一个实例（当前）。
    /// </summary>
    public static new IDictionary<TKey, TValue> Instance => Singleton<Dictionary<TKey, TValue>>.Instance;
}